<%@page import="org.apache.commons.lang3.StringUtils"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>  
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="admin_url" value="${admin_url}"/>
<shiro:hasAnyRoles name="sa,admin,projectadmin">  
<%--     <%
	    String redirectURL =request.getContextPath()+"/admin";
	    response.sendRedirect(redirectURL);	    
	    out.print(redirectURL); 
	%> --%>
	<c:redirect url="/${admin_url}"/> 
</shiro:hasAnyRoles>
<shiro:hasRole name="couponadmin" >
	<c:redirect url="/${admin_url}/manage/preferential/list"/>
</shiro:hasRole>
<shiro:hasRole name="financeadmin" >
	<c:redirect url="/${admin_url}/manage/finance"/>
</shiro:hasRole>
<shiro:hasAnyRoles name="user, institution, charitarian">  
     <%
    	String redirectURL = request.getHeader("Referer");
    	if(StringUtils.isBlank(redirectURL) || StringUtils.contains(redirectURL, "login")){
    		redirectURL = request.getContextPath() + "/home";
    	}
	    response.sendRedirect(redirectURL);
	    out.println(redirectURL);
	%>
</shiro:hasAnyRoles>


<c:if test="${env == 'production' }">
<script type="text/javascript">
	seajs.use("${ctx}/assets/js-dist/index-page");
</script>
</c:if>
<c:if test="${env != 'production' }">
<script type="text/javascript">
	seajs.use("${ctx}/assets/js/index-page");
</script>
</c:if>
